Imports System.Data
Imports System.Data.SqlClient
Partial Class xdonhang
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim idsanpham As Int16, sSql As String
        If Trim(Session("admin")) = "" Then
            Response.Redirect("../login/loginadmin.aspx")
        Else
            If IsNumeric(Request.QueryString("id")) Then
                idsanpham = Request.QueryString("id")
                sSql = "delete from ctdonhang where iddonhang=" & idsanpham
                Dim myConn As New SqlConnection(ConfigurationManager.AppSettings("cons"))
                Dim myComm As New SqlCommand(sSql, myConn)
                myConn.Open()
                myComm.CommandText = sSql
                myComm.ExecuteNonQuery()
                sSql = "delete from donhang where iddonhang=" & idsanpham
                myComm.CommandText = sSql
                myComm.ExecuteNonQuery()
                myConn.Close()
                Response.Redirect("donhang.aspx")
            End If
        End If
    End Sub

End Class
